﻿#查找路径下面所有源文件
aux_source_directory(. SRC_LIST)

#设置预处理
add_definitions(-D_USRDLL)

IF(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
		message( STATUS " plugins GCC " )
		set(PLATFORM_LINK_LIBRIES rt)
        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
ENDIF()

INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/)
#设置静态库
add_library(PluginManager SHARED ${SRC_LIST})

#设置预编译
SET_TARGET_PROPERTIES(PluginManager PROPERTIES COTIRE_CXX_PREFIX_HEADER_INIT "stdafx.h")
cotire(PluginManager)


#设置输出扩展名
set_target_properties(PluginManager PROPERTIES SUFFIX ".pln")
#设置linux 去掉lib的前缀
IF(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
set_target_properties(PluginManager PROPERTIES PREFIX "")
ENDIF()
#设置目录
set_target_properties(PluginManager PROPERTIES FOLDER "Plugins")

IF(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
		install(TARGETS PluginManager 
        LIBRARY DESTINATION ${PROJECT_BINARY_DIR}/bin/plugins)
ELSE()
		install(TARGETS PluginManager 
        RUNTIME DESTINATION ${PROJECT_BINARY_DIR}/bin/plugins
		LIBRARY DESTINATION ${PROJECT_SOURCE_DIR}/3rdlib/lib)
ENDIF()



#复制头文件到inchhvi
#install(FILES util.h DESTINATION ${PROJECT_SOURCE_DIR}/3rdlib/include/common)


